home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Magazin/MacEasy 12
/
Mac Magazin and MacEasy Magazine CD - Issue 12.iso
/
Sharewarebibliothek
/
Anwendungen
/
Grafik
/
Matt's_Fract(Fat)101
/
Sources
/
includes
/
DialogUtils.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-06-26
|
2KB
|
87 lines
#include "AllTools.h"
Rect GetDRect(DialogPtr dialog, short itemNo)
{
short iType;
Handle iHandle;
Rect iRect;
GetDItem( dialog, itemNo, &iType, &iHandle, &iRect);
return iRect;
}
void SetDRect(DialogPtr dialog, short itemNo, Rect rect)
{
short iType;
Handle iHandle;
Rect iRect;
GetDItem( dialog, itemNo, &iType, &iHandle, &iRect);
SetDItem( dialog, itemNo, iType, iHandle, &rect);
}
void SetTheInfoStr(DialogPtr theDialog, short itemNo, Str255 aValue)
{
short iType;
Handle iHandle;
Rect iRect;
GetDItem( theDialog, itemNo, &iType, &iHandle, &iRect);
SetIText(iHandle, aValue);
}
void SetTheInfo(DialogPtr theDialog, short itemNo, long aValue)
{
short iType;
Handle iHandle;
Rect iRect;
Str255 Strng;
GetDItem( theDialog, itemNo, &iType, &iHandle, &iRect);
NumToString(aValue, Strng);
SetIText(iHandle, Strng);
}
void GetTheInfoStr(DialogPtr theDialog, short itemNo, StringHandle string)
{
short iType;
Handle iHandle;
Rect iRect;
GetDItem( theDialog, itemNo, &iType, &iHandle, &iRect);
GetIText(iHandle, *string);
}
void CenterDialog(DialogPtr dialog, videoInfo theScreen)
{
Rect dialogRect;
short dialogWidth, dialogDepth;
dialogRect = ((DialogPeek)dialog)->window.port.portRect;
dialogWidth = dialogRect.left - dialogRect.right;
dialogDepth = dialogRect.top - dialogRect.bottom;
MoveWindow(dialog, ((theScreen.resolutionX + dialogWidth) >> 1),
((theScreen.resolutionY + dialogDepth) >> 1), FALSE);
}
void ToggleCheckBox(DialogPtr dialog, short item)
{
short type;
Handle itemHdl;
Rect box;
GetDItem(dialog, item, &type, &itemHdl, &box);
SetCtlValue((ControlHandle)itemHdl, (GetCtlValue((ControlHandle)itemHdl) == 0) ? 1 : 0);
}
void SetCheck(DialogPtr dPtr, short ChkItem, short value)
{
short theType;
Handle theItem;
Rect theBox;
GetDItem(dPtr, ChkItem, &theType, &theItem, &theBox);
SetCtlValue((ControlHandle)theItem, value);
}